//给打包文档使用
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const {VueLoaderPlugin} = require('vue-loader');
module.exports = {
  mode:'development',
  devtool:'source-map',
  entry:path.resolve(__dirname,'main.ts'),
  output:{
    path:path.resolve(__dirname,'../website-dist'),
    filename:'bundle.js'
  },
  resolve:{ //解析模块，对应的扩展名有哪些
    extensions:['.ts','.tsx','.js','.vue']
  },
  module:{// loader 三种写法  { }  ""  []
    rules:[
      {test:/\.vue$/,loader:'vue-loader'},
      {test:/\.(ts|js)x?$/,exclude:/node_modules/,loader:'babel-loader'},
      {test:/\.(svg|otf|ttf|woff|woff2|eot|gif|png)$/,loader:'url-loader'},
      {test:/\.(scss|css)/,use:['style-loader','css-loader','sass-loader']}
    ]
  },
  plugins:[
    new VueLoaderPlugin(),
    new HtmlWebpackPlugin({
      template:path.resolve(__dirname,'template.html')
    })
  ]
}

//yarn add webpack@5.26.3 webpack-cli@4.5.0 webpack-dev-server@3.11.2 vue-loader@16.1.2 @vue/compiler-sfc@3.0.7 -D -W
//yarn add babel-loader@8.2.2 @babel/core@7.13.10 @babel/preset-env@7.13.10 @babel/preset-typescript@7.13.0 url-loader@4.1.1 file-loader@6.2.0 html-webpack-plugin@5.3.1 css-loader@5.1.3 sass-loader@11.0.1 style-loader@2.0.0 sass@1.32.8 -D -W
//babel-plugin-module-resolver